package top.lzzly.sync.kafka.server;

import com.alibaba.fastjson.JSON;
import org.elasticsearch.action.delete.DeleteRequest;
import org.elasticsearch.action.delete.DeleteResponse;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.XContentType;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author smq
 * @Date 2021/10/30 20:42
 * @Uint d9lab
 * @Description:
 */
public interface IEsService {

    /**
     * 新增、更新es
     *
     * @param id
     * @param esType
     * @param object
     * @throws IOException
     */
    void addQuestionToEs(String id, String esType, Object object) throws IOException;

    /**
     * 删除es
     *
     * @param id
     * @param esType
     */
    void deleteQuestion(String id, String esType);

    /**
     * es查询
     *
     * @param map
     * @return
     * @throws IOException
     */
    <T> List<T> search(String index, Map<String, String> map,Class<T> t) throws IOException;
}
